package cc.bean

import android.os.Parcelable
import android.widget.ImageView
import androidx.databinding.BaseObservable
import androidx.databinding.Bindable
import androidx.databinding.BindingAdapter
import cc.news.BR
import com.squareup.picasso.Picasso
import kotlinx.android.parcel.Parcelize

/**
 * 新闻数据类
 * @param title 标题
 * @param content 内容
 * @param imgs 图片
 */

data class NewsInfo(var title: String? = null, var content: String? = null, var imgs: String? = null, var linkUrl: String? = null) : BaseObservable() {
    @Bindable
    var isRead = false
//        set(value) {
//            field = value
//            notifyPropertyChanged(BR.isRead)
//        }
}

@BindingAdapter("loadImg")
fun setImg(iv: ImageView, imgs: String?) {
    imgs?.let {
        Picasso.with(iv.context).load(imgs).into(iv);
    }
}
